package com.jeffpalm.pandoralastfm;


/**
 * A command line program that takes command as arguments and executes them immediately.
 */
public class CommandLine extends App {

  public static void main(String[] args) {
    new CommandLine().realMain(args);
  }

  private void realMain(String[] args) {
    for (String arg : args) {
      outln(execute(arg));
    }
  }

  private String execute(String cmd) {
    String s = cmd.toLowerCase();
    if (s.equals("up")) {
      return getBridge().up().getMessage();
    }
    if (s.equals("down")) {
      return getBridge().down().getMessage();
    }
    if (s.equals("next")) {
      return getBridge().next().getMessage();
    }
    throw new IllegalArgumentException("Invalid command: " + cmd);
  }

}
